;;----------------------------------------------------------------------
;; plot zonal distribution of ion production 
;;----------------------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$KAILIBROOT/lib_radon.ncl"

begin
 
  plotform = "eps" 
  plotform = "pdf" 
  plotname = "fig_zonal" 


  cnLineLabelFontHeightF = 0.025 

  tmXBLabelFontHeightF   = 0.030
  tmYLLabelFontHeightF   = 0.030
  tmXTLabelFontHeightF   = 0.030
  tmYRLabelFontHeightF   = 0.030

  tiMainFontHeightF      = 0.05 
  tiXAxisFontHeightF     = 0.035
  tiYAxisFontHeightF     = 0.035

  lbLabelFontHeightF     = 0.030 
  

  tiXAxisString   = "" 
  tiYAxisString   = ""  
 
  gsnLeftString   = ""  
  gsnRightString  = ""  
  gsnCenterString = ""  

  gsnLeftStringFontHeightF   = 0.035 
  gsnRightStringFontHeightF  = 0.035 
  gsnCenterStringFontHeightF = 0.035 
 


  colormap = "amwg"
  colormap = "ViBlGrWhYeOrRe"
  colormap = "testcmap"

  gsn_define_colormap(wks,colormap)         ; choose a colormap

;;----------------------------------------------------------------------
;; plot settings:  
;;----------------------------------------------------------------------
 
  res                  = True    ; contour mods desired
  res@gsnFrame         = False   ; don't draw yet
  res@gsnDraw          = False   ; don't advance frame yet
  res@gsnMaximize      = True

  res@tiMainOn         = False   ; no title 
  res@cnFillOn         = True    ; turn on color
  res@cnLinesOn        = False   ; turn off contour lines
  res@cnLineThicknessF = 1.     ; thicker lines
  res@cnLevelSelectionMode  = "ManualLevels"  ; set manual cn levels
  res@cnMinLevelValF   =    0.     ; set min contour level
  res@cnMaxLevelValF   = 8000.     ; set max contour level
  res@cnLevelSpacingF  = 1000.
  res@cnInfoLabelOn    = False    ; no contour labels
 ;res@cnFillMode       = "RasterFill"  ; turn on raster mode
 ;res@cnFillDrawOrder  = "PreDraw"     ; draw contours before continents

;;----------------------------------------------------------------------
;; colors  
;;----------------------------------------------------------------------
  res@gsnSpreadColors = True    ; use full colormap

  if (colormap.eq."testcmap") then 
     res@gsnSpreadColorStart = 50           ; start at color 2
     res@gsnSpreadColorEnd   = 180          ; don't use added gray
  end if 
  if (colormap.eq."ViBlGrWhYeOrRe") then
     res@gsnSpreadColorStart = 24           ; start at color 2
     res@gsnSpreadColorEnd   = 95          ; don't use added gray
  end if
 
;;----------------------------------------------------------------------
;; strings 
;;----------------------------------------------------------------------
  res@gsnLeftString    = "" 
  res@gsnCenterString  = "" 
  res@gsnRightString   = ""

  res@gsnLeftStringFontHeightF   = StringFontHeightF 
  res@gsnCenterStringFontHeightF = StringFontHeightF 
  res@gsnRightStringFontHeightF  = StringFontHeightF 

 
;;----------------------------------------------------------------------
;; lable bar 
;;----------------------------------------------------------------------
  res@lbLabelBarOn       = True       ; no individual label bar
  res@lbLabelStride      = 2          ; every other label bar label
  res@lbOrientation      = "Vertical" ; vertical label bar
  res@lbLabelFontHeightF = lbLabelFontHeightF 
  res@pmLabelBarWidthF   = 0.1        ; default is shorter
  res@pmLabelBarHeightF  = 0.6        ; default is taller

  res@trYReverse         = False      ; reverse y axis
 ;res@trYMinF            = 0.         ; set minimum Y-axis value
 ;res@trYMaxF            = 8000.      ; set maximum Y-axis value
 ;res@trXMinF            = 1949.      ; set minimum X-axis value
 ;res@trXMaxF            = 2006.      ; set maximum X-axis value

  res@vpWidthF           = 1.0        ; width of contour plots


;;----------------------------------------------------------------------
;; tickmark 
;;----------------------------------------------------------------------
  res@tmYLMode = "Explicit"	
  res@tmYLValues = (/100.,200.,400.,600.,800.,1000.,2000.,3000.,4000./)
  res@tmYLLabels = (/"100","200","400","600","800","1000","2000","3000","4000"/)
  res@tmYLMinorValues  = ispan(0,4000,200)

  res@tmXBLabelFontHeightF = tmXBLabelFontHeightF
  res@tmYLLabelFontHeightF = tmYLLabelFontHeightF
 
;;----------------------------------------------------------------------
;; plot array 
;;----------------------------------------------------------------------

  plot = new(9,graphic)                          ; create graphical array



;;----------------------------------------------------------------------
;; ANN panel 1 
;;----------------------------------------------------------------------

  ip = 0 

  res@gsnRightString = "ANN"
  res@gsnLeftString   = gsnLeftString(ip) 
  res@gsnCenterString = gsnCenterString(ip) 
  res@cnLinesOn       = False    ; turn off contour lines
  res@cnFillOn        = True     ; turn on color
  res@cnMinLevelValF  = 0.       ; set min contour level
  res@cnMaxLevelValF  = 8.       ; set max contour level
  res@cnLevelSpacingF = 1.
  res@lbLabelStride   = 2          ; every other label bar label
  res@lbLabelBarOn    = True       ; no individual label bar
  res@tiYAxisString   = tiYAxisString(ip) 
  plot(ip) = gsn_csm_contour(wks,prna,res)

;;----------------------------------------------------------------------
;; line over color 
;;----------------------------------------------------------------------

  res@cnFillOn        = False   ; turn on color
  res@cnLinesOn       = True    ; turn off contour lines
  res@cnLineThicknessF= 2.      ; thicker lines
  res@cnLineLabelFontHeightF = cnLineLabelFontHeightF 
 ;res@cnMonoLineDashPattern  = True
  res@cnLineLabelPlacementMode = "Constant" 
  res@cnLineDashPatterns  = 2   ; Define line patterns.
  res@cnLineDashSegLenF   = 0.18          ; assist in controlling concentration
  res@cnLineLabelInterval = 1             ; default = 2 
  res@cnMinLevelValF  = 2.      ; set min contour level
  res@cnMaxLevelValF  = 12.   ; set max contour level
  res@cnLevelSpacingF = 2. 
  res@lbLabelStride   = 1       ; every other label bar label
  plotover = gsn_csm_contour(wks,prma,res)          ; draw second plot
  overlay(plot(ip),plotover)                              ; now over lay plots 

  delete(plotover) 

 

;;----------------------------------------------------------------------
;; panel plot 
;;----------------------------------------------------------------------

  resp                    = True   ; panel mods desired
  resp@gsnFrame           = False  ; don't advance frame yet
 ;resp@gsnPanelBottom     = 0.0    ; space for label bar
 ;resp@gsnPanelTop        = 0.5    ; only panel on lower half of page
 ;resp@gsnPanelLabelBar   = True   ; common label bar
 ;resp@pmLabelBarWidthF   = 0.8    ; label bar width
 
  resp@gsnPanelYWhiteSpacePercent = 5
  resp@gsnPanelXWhiteSpacePercent = 0
 
  gsn_panel(wks,plot(0:8),(/3,3/),resp)

  frame(wks) 

  ;; output plot information 


end
 
          


